<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.prime.com.tr/ui">
      
    <ui:composition template="/new-template/template-crud.xhtml">
    	
    	<ui:define name="tituloPagina">
    		<h:outputText value="Cadastro de Carga :: ZPE" />
    	</ui:define>
    	
    	<ui:define name="parametros">
    	   <ui:param name="bean" value="#{cargaBean}" />
    	</ui:define>
    	
    	<ui:define name="tituloFieldSetFiltro">
    	    <h:outputText value="Pesquisa de Carga" />
    	</ui:define>
    	
    	<ui:define name="camposFiltro">
			
			<h:panelGrid columns="2" columnClasses="colunaBusca" styleClass="table">
  	    		<h:outputText value="Descrição:" />
  	    		<h:inputText value="#{bean.entitySearch.codigo}"/>
  	    	</h:panelGrid>

    	</ui:define>
    	
    	<ui:define name="tituloPainel">
    	   <ui:param name="tituloPainel" value="Cargas" />
    	</ui:define>
    	
    	<ui:define name="resultFiltro">
			<p:dataTable align="center" 
				 width="600px" styleClass="table" 
				 id="tableSearchCargas"
				 rows="10"
			 	 pageLinks="3"
			     paginatorAlwaysVisible="false"
			     paginator="true"
				 paginatorPosition="bottom"
			     emptyMessage="Nenhum Grupo Ocupacional foi encontrado."
   				 value="#{bean.resultSearch}" 
       			 var="carga" 
				 rowStyleClass="bgLinha1,bgLinha2">
       					
				<p:column headerText="" style="width:60px; text-align:center;">
					<div class="colunaAcao">					    			
						<h:commandButton style="border:none;" 
							id="cmdUpd"
							image="#{resource['img:ico_edit.gif']}"
							actionListener="#{bean.prepareUpdate}">
							<p:ajax update=":painelGlobal" />
						</h:commandButton>
					</div>
				</p:column>
       						
				<p:column headerText="ID" style="text-align:center;">
					<h:outputText value="#{carga.id}" />
				</p:column>
				
				<p:column headerText="Número CE" style="text-align:left;" >
					<h:outputText value="#{carga.numeroCE}" />
				</p:column>
				
				<p:column headerText="Proprietário" style="text-align:left;" >
					<h:outputText value="#{carga.proprietario.cnpj} - #{carga.proprietario.descricao}" />
				</p:column>

				<p:column style="width:60px; text-align:center;">
					<f:facet name="header">
						<h:selectBooleanCheckbox styleClass="ui-checkBoxMain" onchange="checkboxAll(this);" />
					</f:facet>
					<h:selectBooleanCheckbox styleClass="ui-checkBox" valueChangeListener="#{bean.select}" />
				</p:column>
       						
			</p:dataTable> 
    	
    	</ui:define>
    	
    	<ui:define name="tituloFieldSetInsert">
		  <h:outputLabel value="&nbsp; Cadastro de Carga &nbsp;" />
		</ui:define>
    	
    	<ui:define name="camposInsert">
    		
    		<h:panelGrid columns="4" columnClasses="colunaBusca" rendered="#{bean['editing']}">
					  <h:outputLabel value="Código: "/>
					  <h:inputText   
								   label="Código" readonly="true"
								   value="#{bean.entity.id}" 
								   maxlength="50" 
								   size="40">						
					  </h:inputText>
					  
			</h:panelGrid>
			<div style="width:70%;   float:left">

				<fieldset>

					<legend><h:outputText value="ACESSO DE CARGA" /></legend>

					<h:panelGrid columns="2" id="pnlTransportadora">

						<h:outputLabel value="Transportadora "/>

						<h:column>

							<h:inputText label="Transportador" id="transportadora"
								   value="#{bean.transportadora.descricao}"
								   maxlength="50" size="40">						
							</h:inputText>
											 
				  			<p:commandButton styleClass="btn btn-success" 
											 value="Buscar"
											 update="formCadastro formPanel"
											 actionListener="#{bean.listTransportadoras}" process="transportadora @this" />
						</h:column>
						
					</h:panelGrid>
					
					<p:spacer height="10" />
										
					<p:dataTable align="center" value="#{bean.transportadorasSelecionadas}" var="n" 
						id="tableTransportadorasSelecionadas" emptyMessage="Nenhuma transportadora adicionada.">
		       					
						<p:column headerText="ID" style="text-align:center;">
							<h:outputText value="#{n.id}" />
						</p:column>
						
						<p:column headerText="CNPJ" style="text-align:left;" >
							<h:outputText value="#{n.cnpj}" />
						</p:column>

						<p:column headerText="Nome" style="text-align:left;" >
							<h:outputText value="#{n.descricao}" />
						</p:column>
						
						<p:column headerText="" style="text-align:center;" >
							
				  			<p:commandButton styleClass="btn btn-success" 
											 value="Deletar"
											 update="formCadastro:tableTransportadorasSelecionadas"
											 actionListener="#{bean.removerTransportadora}" process="@this" />
							
							
						</p:column>

					</p:dataTable>			
					
					
				</fieldset>
			</div>
			<br style="clear:both;" /> 

			<div style="width:100%;   float:left ">
			
				<fieldset>
			
					<legend><h:outputText value="DADOS GERAIS" /></legend>
			
					<h:panelGrid columns="4" width="100%" id="pnlDadosGerais" cellpadding="3">
			
						<h:outputLabel value="Proprietário: "/>
						<h:column>
							<h:inputText id="CNPJProprietario"
								   label="CNPJ Proprietário" 
								   value="#{bean.entity.proprietario.cnpj}" 
								   maxlength="50" 
								   size="30">						
							</h:inputText>
			  			<p:commandButton styleClass="btn btn-success" 
										 value="Buscar"
										 update=":formCadastro :formPanel"
										 actionListener="#{bean.listProprietarios}" process="CNPJProprietario, @this" />

						</h:column>
						
						<h:outputLabel value="Nome Proprietário: "/>
						<h:inputText label="Nome Proprietário" readonly="true"
								   value="#{bean.entity.proprietario.descricao}" 
								   maxlength="50" 
								   size="40">						
					  	</h:inputText>
						
						<h:outputLabel value="Acondicionamento: "/>
						
						<h:selectOneMenu disabled="#{bean['editing']}"
							value="#{bean.entity.acondicionamento}"
							 
							  label="Acondicionamento" >
							<f:selectItem itemValue="#{null}" itemLabel="Selecione" />
							<f:selectItems value="#{bean.acondicionamento}" />
							<p:ajax update="@form" event="change" listener="#{bean.validaTipoAcondicionamento}" />
						</h:selectOneMenu>					
			
						<h:outputLabel value="Regime Aduaneiro: "/>
						<h:inputText   
								   label="Saída" readonly="true"
								   value="#{bean.entity.regimeAduaneiro}" 
								   maxlength="50" 
								   size="40">						
					  	</h:inputText>
					  	
						<h:outputText value="Data Entrada: " />
						<p:calendar styleClass="data"
							value="#{bean.entity.entrada}" 
							pattern="dd/MM/yyyy" 
							readonlyInput="true" 
							showOn="button" />

						<h:outputLabel value="Quantidade Total Declarada(und): "/>
						<h:inputText  styleClass="numerico" 
								   label="Quantidade Total Declarada" readonly="#{bean.entity.acondicionamento == 'CONTEINER'}"
								   value="#{bean.entity.quantidadeItens}" 
								   maxlength="12" 
								   size="40">		
					  	</h:inputText>

						<h:outputLabel value="Peso Total Declarado(kg): "/>
						<h:inputText  styleClass="decimal3" converter="myDoubleConverter"
								   label="Peso total declarado" readonly="#{bean.entity.acondicionamento == 'CONTEINER'}"
								   value="#{bean.entity.pesoTotal}" 
								   maxlength="12" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Volume Total Declarado(m³): "/>
						<h:inputText styleClass="decimal3"  converter="myDoubleConverter"
								   label="Volume Total Declarado" readonly="#{bean.entity.acondicionamento == 'CONTEINER'}"
								   value="#{bean.entity.volumeTotal}" 
								   maxlength="12" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Observação: "/>
						<h:inputTextarea label="Observação" value="#{bean.entity.observacao}" />
			
					</h:panelGrid>
			
				</fieldset>
			
			</div>
			
			<br style="clear:both;" />			

			<div style="width:100%;  float:left ">
			
				<fieldset>
			
					<legend><h:outputText value="CE" /></legend>
			
					<h:panelGrid columns="4" width="100%" id="pnlCE" cellpadding="3">
						
						<h:outputLabel value="Número do CE: "/>
						<h:inputText styleClass="numerico"
								   label="Número do CE"
								   value="#{bean.entity.numeroCE}" 
								   maxlength="15" 
								   size="25">						
					  	</h:inputText>

						<h:outputLabel value="Packing List: "/>
						<h:inputText label="Packing List" 
								   value="#{bean.entity.packingList}" 
								   maxlength="12" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Número do BL: "/>
						<h:inputText  label="Número do BL" 
								   value="#{bean.entity.numeroBL}" 
								   maxlength="30" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Referência: "/>
						<h:inputText maxlength="12" styleClass="numerico" 
								   label="Referência"
								   value="#{bean.entity.referencia}"
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Fatura: "/>
						<h:inputText maxlength="12" styleClass="numerico" 
								   label="Fatura"
								   value="#{bean.entity.fatura}"  
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="DTA: "/>
						<h:inputText maxlength="12" styleClass="numerico" 
								   label="DTA"
								   value="#{bean.entity.DTA}" 
								   size="40">						
					  	</h:inputText>
					
					</h:panelGrid>
				</fieldset>
			</div>

			<br style="clear:both;" />			

			<div style="width:100%;   float:left ">
			
				<fieldset>
			
					<legend><h:outputText value="DECLARAÇÃO DE ADMISSÃO NO REGIME" /></legend>
			
					<h:panelGrid columns="4" width="100%" id="pnlAdmissao" cellpadding="3">

						<h:outputLabel value="Nº da Declaração: "/>
						<h:inputText   
								   label="Nº da Declaração"
								   value="#{bean.entity.admissaoRegime.numeroDeclaracao}" 
								   maxlength="12"
								   styleClass="numerico" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Confins Suspenso: "/>
						<h:inputText converter="myDoubleConverter" styleClass="decimal2"
								   label="Confins Suspenso"
								   value="#{bean.entity.admissaoRegime.valorCONFINSSuspenso}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Nº da Adição: "/>
						<h:inputText styleClass="numerico" 
								   label="Nº da Adição"
								   value="#{bean.entity.admissaoRegime.numeroAdicao}" 
								   maxlength="12" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Confins Importação: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="Confins Importação"
								   value="#{bean.entity.admissaoRegime.valorCONFINSImportacao}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>
						
						<h:outputLabel value="Nº da Item Adição: "/>
						<h:inputText label="Nº da Item Adição" styleClass="numerico"
								   value="#{bean.entity.admissaoRegime.numeroItemAdicao}" 
								   maxlength="12" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="PIS/PASEP Susp: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="PIS/PASEP Susp"
								   value="#{bean.entity.admissaoRegime.valorPISPASEPSuspensao}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Valor Aduaneiro: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="Valor Aduaneiro"
								   value="#{bean.entity.admissaoRegime.valorAduaneiro}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="PIS/PASEP Imp Susp: "/>
						<h:inputText styleClass="decimal2"  converter="myDoubleConverter"
								   label="PIS/PASEP Imp Susp"
								   value="#{bean.entity.admissaoRegime.valorPISPASESPImportacao}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Vr Imposto Imp: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="Vr Imposto Imp"
								   value="#{bean.entity.admissaoRegime.valorImpostoImp}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="VLMD: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="VLMD"
								   value="#{bean.entity.admissaoRegime.valorVMLD}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="IPI Vinc Susp: "/>
						<h:inputText converter="myDoubleConverter" styleClass="decimal2"
								   label="IPI Vinc Susp"
								   value="#{bean.entity.admissaoRegime.valorIPIVinculadoSuspenso}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Data Registro: "/>
						<p:calendar styleClass="data"
							value="#{bean.entity.admissaoRegime.registro}" 
							pattern="dd/MM/yyyy" 
							readonlyInput="true" 
							showOn="button" />
						
						<h:outputLabel value="IPI Suspenso: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="IPI Suspenso"
								   value="#{bean.entity.admissaoRegime.valorIPISuspenso}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>

						<h:outputLabel value="Data Desembaraço: "/>
						<p:calendar styleClass="data"
							value="#{bean.entity.admissaoRegime.desembaraco}" 
							pattern="dd/MM/yyyy" 
							readonlyInput="true" 
							showOn="button" />
						

						<h:outputLabel value="AFRMM: "/>
						<h:inputText styleClass="decimal2" converter="myDoubleConverter"
								   label="AFRMM"
								   value="#{bean.entity.admissaoRegime.valorAFRMM}" 
								   maxlength="11" 
								   size="40">						
					  	</h:inputText>
					
					</h:panelGrid>
				</fieldset>
			</div>
			
			<div style="width:100%;   float:left ">
					
					<fieldset>
				
						<legend><h:outputText value="NCM" /></legend>
				
						<h:panelGrid columns="4" width="100%" cellpadding="3">
						
							<h:outputLabel value="Código: "/>
							<h:column>
								<h:inputText id="nomeclatura"
										value="#{bean.nomeclaturaNCM.descricao}"  
									   label="Status" 
									   maxlength="50" 
									   size="40">						
								</h:inputText>
					  			
					  			<p:commandButton styleClass="btn btn-success" 
									 value="Buscar"
									 update="formCadastro formPanel"
									 actionListener="#{bean.listNCM}" process="pnlCE,pnlAdmissao,pnlDadosGerais,nomeclatura, @this" />

							</h:column>
						
						
						</h:panelGrid>

						<p:dataTable align="center" value="#{bean.nomeclaturasSelecionadas}" var="n" id="tableNomeclaturasSelecionadas">
			       					
							<p:column headerText="ID" style="text-align:center;">
								<h:outputText value="#{n.id}" />
							</p:column>
							
							<p:column headerText="Sigla" style="text-align:left;" >
								<h:outputText value="#{n.sigla}" />
							</p:column>
	
							<p:column headerText="Nome" style="text-align:left;" >
								<h:outputText value="#{n.descricao}" />
							</p:column>
							
							<p:column headerText="Remover" style="text-align:left;" >
				  				<p:commandButton value="Remover" update="formCadastro:tableNomeclaturasSelecionadas"
				  					onclick="carregando.show();" oncomplete="carregando.hide()"
									 actionListener="#{bean.removeNCM}" />
							</p:column>
							
						</p:dataTable>			

					</fieldset>
				</div>

					<p:spacer height="30px" />
			
			
			<br style="clear:both;" />			

			<h:panelGroup rendered="#{bean.entity.acondicionamento == 'CONTEINER'}">
				<div style="width:100%;   float:left ">
				
					<fieldset>
				
						<legend><h:outputText value="ITEM DE CARGA" /></legend>

						<h:panelGrid columns="4" width="100%" id="pnlItemCarga" cellpadding="3">
						
							<h:outputLabel value="Nº do Item: "/>
							<h:inputText  readonly="true" 
									   label="Nº do Item"
									   value="#{bean.itemCarga.id}" 
									   maxlength="12" 
									   size="40">						
						  	</h:inputText>
							
							<h:outputLabel value="Nº do Contêiner: "/>
							<h:column>
								<h:inputText
										   label="Nº do Contêiner" id="numeroConteiner"
										   required="true" readonly="true"
										   value="#{bean.conteiner.numero}" 
										   maxlength="12"
										   size="40">						
							  	</h:inputText>
						  		<p:commandButton value="..." onclick="panelConteiner.show();"  />
						  	</h:column>
							
							<h:outputLabel value="Saldo em Estoque: "/>
							<h:inputText label="Saldo em Estoque"
									   styleClass="numerico"
									   value="#{bean.itemCarga.saldoEstoque}" 
									   maxlength="12" 
									   size="40">						
						  	</h:inputText>
	
							<p:spacer />
							<p:spacer />
	
							<h:outputLabel value="Localização: "/>
							<h:inputText 
									   label="Localização"
									   value="#{bean.itemCarga.localizacao}" 
									   maxlength="12" 
									   size="40">						
						  	</h:inputText>
							
							<h:outputLabel value="Carga Perigosa? "/>
							<h:selectOneRadio>
								<f:selectItem itemLabel="Não" itemValue="N"  />
								<f:selectItem itemLabel="Sim" itemValue="S"  />
							</h:selectOneRadio>
	
							<h:outputLabel value="Quantidade Total Declarada(Unid): "/>
							<h:inputText styleClass="numerico"   
									   label="Quantidade Total Declarada(Unid)"
									   value="#{bean.itemCarga.qtdeTotalDeclarado}" 
									   maxlength="50" 
									   size="40">						
						  	</h:inputText>
	
							<p:spacer />
							<p:spacer />
	
							<h:outputLabel value="Peso Total Declarado(kg): "/>
							<h:inputText styleClass="decimal3" converter="myDoubleConverter"
									   label="Peso Total Declarado(kg)"
									   value="#{bean.itemCarga.pesoTotalDeclarado}" 
									   maxlength="12" 
									   size="40">						
						  	</h:inputText>
	
	
							<h:outputLabel value="Volume Total Declarado(m³): "/>
							<h:inputText styleClass="decimal3" converter="myDoubleConverter"
									   label="Volume Total Declarado(m³)"
									   value="#{bean.itemCarga.volumeTotalDeclarado}" 
									   maxlength="12" 
									   size="40">						
						  	</h:inputText>
						
							<h:outputLabel value="Cubagem(m³): "/>
							<h:inputText styleClass="decimal3"  
									   label="Cubagem(m³)"
									   value="#{bean.itemCarga.cubagem}" 
									   maxlength="50" 
									   size="40">						
						  	</h:inputText>
						
						</h:panelGrid>
	
						<p:commandButton value="Adicionar Item"
							actionListener="#{bean.adicionarItemCarga}"
							styleClass="btn btn-primary btn-sm"
							onclick="carregando.show();" oncomplete="carregando.hide();"
							update="formCadastro:tableItensAdicionados formCadastro:pnlItemCarga formPanel formCadastro:pnlDadosGerais formCadastro:tableNomeclaturasSelecionadas formCadastro:nomeclatura" 
							style="margin-bottom:30px;" process="formCadastro:pnlItemCarga @this">
							
						</p:commandButton>
	
						<p:spacer height="30px" />
						
					</fieldset>
				</div>
			
				<br style="clear:both;" />
				
				<div style="width:100%;   float:left ">
				
					<fieldset>
				
						<legend><h:outputText value="ITENS DE CARGA ADICIONADOS" /></legend>
					
						<p:dataTable align="center" value="#{bean.itensCargaDataModel}" var="n" id="tableItensAdicionados" >
			       					
							<p:column headerText="Cubagem" style="text-align:left;" >
								<h:outputText value="#{n.cubagem}" />
							</p:column>
	
							<p:column headerText="CONTEINER" style="text-align:left;" >
								<h:outputText value="#{n.conteiner.numero}" />
							</p:column>
							
							<p:column>
								<p:commandButton styleClass="btn btn-success" 
									value="Deletar" update="formCadastro:tableItensAdicionados"
									actionListener="#{bean.removerItemSelecionado}" process="@this" />
							
							</p:column>
							
						</p:dataTable>			
						
					</fieldset>
				</div>
			</h:panelGroup>
			<h:panelGroup id="pnlModals">
				<p:dialog id="panelTransportadoraID" width="600" header="Transportadoras"
						widgetVar="panelTransportadora" fixedCenter="true" showEffect="fade" rendered="#{bean.transportadorasModal.rowCount > 1}"
						hideEffect="fade" visible="true" modal="true">
				
						<p:dataTable align="center" value="#{bean.transportadorasModal}" var="t" id="tableTransportadoras">
			       					
							<p:column headerText="ID" style="text-align:center;">
								<h:outputText value="#{t.id}" />
							</p:column>
							
							<p:column headerText="CNPJ" style="text-align:left;" >
								<h:outputText value="#{t.cnpj}" />
							</p:column>
	
							<p:column headerText="Nome" style="text-align:left;" >
								<h:outputText value="#{t.descricao}" />
							</p:column>
	
							<p:column headerText="Selecionar" style="text-align:left;" >
								<p:commandButton value="Selecionar" actionListener="#{bean.selectTransportadora}" 
									process="@this" onclick="panelTransportadora.hide()" 
									update=":formCadastro :formPanel" />
							</p:column>
							
						</p:dataTable>			
				</p:dialog>
	
				<p:dialog id="panelProprietarioID" width="400" header="Proprietarios"
						widgetVar="panelProprietario" fixedCenter="true" showEffect="fade"
						hideEffect="fade" visible="true" modal="true" rendered="#{bean.proprietariosModal.rowCount > 1}">
				
						<p:dataTable align="center" value="#{bean.proprietariosModal}" var="t">
			       					
							<p:column headerText="ID" style="text-align:center;">
								<h:outputText value="#{t.id}" />
							</p:column>
							
							<p:column headerText="Nome" style="text-align:left;" >
								<h:outputText value="#{t.descricao}" />
							</p:column>
	
							<p:column headerText="Selecionar" style="text-align:left;" >
								<p:commandButton value="Selecionar" actionListener="#{bean.selectProprietario}" 
									process="@this" onclick="panelProprietario.hide()" 
									update=":formCadastro :formPanel" />
							</p:column>
							
						</p:dataTable>
									
				</p:dialog>
	
				<p:dialog id="panelNCMID" width="400" header="Pesquisar NCM"
						widgetVar="panelNCM" fixedCenter="true" showEffect="fade"
						hideEffect="fade" visible="true" modal="true" rendered="#{bean.nomeclaturasModal.rowCount > 1}">
				
						<p:dataTable align="center" value="#{bean.nomeclaturasModal}" var="n">
			       					
							<p:column headerText="ID" style="text-align:center;">
								<h:outputText value="#{n.id}" />
							</p:column>
							
							<p:column headerText="Sigla" style="text-align:left;" >
								<h:outputText value="#{n.sigla}" />
							</p:column>
	
							<p:column headerText="Nome" style="text-align:left;" >
								<h:outputText value="#{n.descricao}" />
							</p:column>
	
							<p:column headerText=" " style="text-align:left;" >
								<p:commandButton value="Selecionar" actionListener="#{bean.selectNCM}" 
									process="@this" onclick="panelNCM.hide()" 
									update=":formCadastro :formPanel" />
							</p:column>
							
						</p:dataTable>			
	
				</p:dialog>
	
				<p:dialog id="panelConteinerID" width="600" header="Contêiner do Item da Carga"
						widgetVar="panelConteiner" fixedCenter="true" showEffect="fade" 
						hideEffect="fade" visible="false" modal="true">
					
					<h:panelGroup id="painelModalConteiner">
					
						<h:panelGrid columns="4" id="pnlConteiner">
							
							<h:outputText value="Sigla: " />
							<h:inputText value="#{bean.conteiner.sigla}" />
							
							<h:outputText value="Nº Contêiner: " />
							<h:inputText value="#{bean.conteiner.numero}" styleClass="numerico" maxlength="12"  />
	
							<h:outputText value="Dígito: " />
							<h:inputText value="#{bean.conteiner.digito}" styleClass="numerico" maxlength="1" />

							<h:outputText value="Tara: " />
							<h:inputText value="#{bean.conteiner.tara}" styleClass="decimal3" maxlength="12" converter="myDoubleConverter" />
	<!-- 
							<h:outputText value="CNPJ/CPF Armador: " />
	
							<p:column  colspan="3">
								<h:inputText value="#{bean.nomeclaturaNCM.id}" size="20" />
								<h:inputText value="#{bean.nomeclaturaNCM.id}" size="40" />
							</p:column>
	 -->
						</h:panelGrid>
						
						<fieldset>
							<legend><h:outputText value="Lacre" /></legend>
							
							<h:panelGrid columns="2" id="pnlLacre">
							
								<h:outputText value="Número: " />
								
								<h:column>
									<h:inputText value="#{bean.lacre.descricao}" id="numeroLacre"/>
									<p:commandButton value="Adicionar" ajax="true" actionListener="#{bean.addLacre}" process="@this pnlLacre" update="pnlLacre formCadastro:tableLacresSelecionados formPanel" />
								</h:column>
	
							</h:panelGrid>
	
							<p:dataTable align="center" value="#{bean.lacresSelecionados}"
								rows="3"
							 	pageLinks="3"
							    paginatorAlwaysVisible="false"
							    paginator="true"
								paginatorPosition="bottom" 
								var="l" id="tableLacresSelecionados">
				       					
								<p:column headerText="Nome" style="text-align:left;" >
									<h:outputText value="#{l.descricao}" />
								</p:column>
	
								<p:column headerText="" style="text-align:center;" >
									
						  			<p:commandButton styleClass="btn btn-success" 
													 value="Deletar"
													 update="formCadastro:tableLacresSelecionados"
													 actionListener="#{bean.removerLacre}" process="@this" />
									
									
								</p:column>
								
						</p:dataTable>
						
						</fieldset>
						</h:panelGroup>
						<p:commandButton value="Aplicar"
							onclick="panelConteiner.hide();"
							process="formCadastro:pnlConteiner formCadastro:numeroConteiner"
							update="formCadastro:pnlConteiner formCadastro:numeroConteiner"/>
						
						<p:commandButton value="Limpar" 
							update="formCadastro:painelModalConteiner formCadastro:numeroConteiner" 
							actionListener="#{bean.limparModalConteiner}"  
							process="@this" />
						
				</p:dialog>
			</h:panelGroup>
		<script type="text/javascript">
		/* <![CDATA[ */
			console.log('teste');
		
			jQuery(function($){
				
				$j('.numerico').setMask({ mask : '999999999999', type : 'reverse' });
				$j('.data input').setMask({ mask : '99/99/9999'});
				$j('.decimal2').setMask({ mask : '99,9999999999', type : 'reverse' });
				$j('.decimal3').setMask({ mask : '999,999999999', type : 'reverse' });
				
			});
		/* ]]> */
	</script>

    	</ui:define>

</ui:composition>

</html>